I have a bunch of documents which have objects that link to other objects which are headings. These objects include the section reference within the text, between < >. We currently have a JavaScript within a template that can find the section number and fills it in when the template is run. For example, we could have a text object that links to Section 2.2 (which is object 34) by including <Prefix_34> in the text. When the template is run, the script will then fill in 2.2 in place of the <Prefix_34> text. Now, onto the issue I'm having... If there is a link or section references within a table cell, it currently is unable to use the same code to find and replace the reference. Here is the code for normal text references:
var TextInit = Object_Text;
var Temp = "";
var Temp1 = "";
var Temp2 = "";
//splitID is array of IDs of all links (in- and out-links)
for (var p=0; p < splitID.length; p++) {
if (Object_Text.indexOf("<" + Prefix_Designation + splitID[p]) >=0) {
//Prefix_Designation is variable that retrieve the prefix of the objects
Temp = "<" + Prefix_Designation + "splitID[p] + ">";
Temp1 = TextInit.split(Temp);
for (var i=0; i<Temp1.length; i++) {
if (i==0) {
Temp2 = Temp1[i];
} else {
Temp2 = Temp2 + splitNum[p] + Temp1[i];
}
}
TextInit = Temp2;
}
}
chrscote - Wed Dec 20 15:25:41 EST 2017 |
Re: Retrieving references from table cells I don't see why there should be any difference between normal objects and table cells. Could it be that you do not use DOORS tables but RTF tables pasted from Word? In this case you would have to traverse the RTF paragraphs - but still, an "Object_Text.indexOf" should work. very strange. Perhaps you do not show Object Text in DOORS cells (View -> table attributes -> default table attribute)? How do you fill the variable Object_Text? How do you connect Object_Text, TextInit (JS) and the DOORS objects? |